package com.wlc.mapper;

import com.wlc.pojo.LeaveApplication;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;

@Mapper
public interface LeaveMapper {

    /**
     * 查询请假申请总数
     */
    Long selectLeaveCount(@Param("applicantId") Long applicantId,
                          @Param("leaveType") Integer leaveType,
                          @Param("status") Integer status,
                          @Param("startDate") String startDate,
                          @Param("endDate") String endDate);

    /**
     * 分页查询请假申请列表
     */
    List<LeaveApplication> selectLeaveList(@Param("applicantId") Long applicantId,
                                           @Param("leaveType") Integer leaveType,
                                           @Param("status") Integer status,
                                           @Param("startDate") String startDate,
                                           @Param("endDate") String endDate,
                                           @Param("offset") Integer offset,
                                           @Param("limit") Integer limit);

    /**
     * 根据ID查询请假申请
     */
    LeaveApplication selectById(Long id);

    /**
     * 新增请假申请
     */
    int insert(LeaveApplication leaveApplication);

    /**
     * 更新请假申请
     */
    int update(LeaveApplication leaveApplication);

    /**
     * 删除请假申请
     */
    int deleteById(Long id);

    /**
     * 更新请假申请状态
     */
    int updateStatus(@Param("id") Long id,
                     @Param("status") Integer status,
                     @Param("approverId") Long approverId,
                     @Param("approverName") String approverName,
                     @Param("approveRemark") String approveRemark);


}